package org.edu.modules.sxjy.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.edu.common.api.vo.Result;
import org.edu.modules.sxjy.entity.VeApply;
import org.edu.modules.sxjy.entity.VeBaseStudent;
import org.edu.modules.sxjy.entity.VeClassTeacher;
import org.edu.modules.sxjy.entity.VeCommon;
import org.edu.modules.sxjy.entity.VeCompany;
import org.edu.modules.sxjy.entity.VeCompanyUser;
import org.edu.modules.sxjy.entity.VePost;
import org.edu.modules.sxjy.entity.VeStudent;
import org.edu.modules.sxjy.entity.VeStudentInfo;
import org.edu.modules.sxjy.feign.VeCommonClient;
import org.edu.modules.sxjy.mapper.VeApplyMapper;
import org.edu.modules.sxjy.mapper.VePracticeMapper;
import org.edu.modules.sxjy.service.IVeApplyService;
import org.edu.modules.sxjy.service.IVeClassTeacharService;
import org.edu.modules.sxjy.service.IVeCompanyService;
import org.edu.modules.sxjy.service.IVeCompanyUserService;
import org.edu.modules.sxjy.service.IVePostService;
import org.edu.modules.sxjy.utils.DateUtils;
import org.edu.modules.sxjy.vo.VeApplyAddVo;
import org.edu.modules.sxjy.vo.VeApplyEditVo;
import org.edu.modules.sxjy.vo.VeApplyInfoVo;
import org.edu.modules.sxjy.vo.VeApplyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class VeApplyServiceImpl
        extends ServiceImpl<VeApplyMapper, VeApply>
        implements IVeApplyService
{
    @Autowired
    private IVeApplyService veApplyService;
    @Autowired
    private VeApplyMapper veApplyMapper;
    @Autowired
    private IVeCompanyService veCompanyService;
    @Autowired
    private IVePostService vePostService;
    @Autowired
    private VeCommonClient veCommonClient;
    @Autowired
    private IVeCompanyUserService veCompanyUserService;
    @Autowired
    private IVeClassTeacharService veClassTeacharService;
    @Autowired
    private VePracticeMapper vePracticeMapper;
    @Autowired
    private VePracticeServiceImpl vePracticeService;

    public List<VeApplyVo> selectAll(VeApplyVo veApplyVo, Integer startLine, Integer pageSize, VeCommon veCommon)
    {
        List<VeApplyVo> veApplyVoList = new ArrayList();
        VeCompanyUser veCompanyUser;
        if (veCommon.getUserType().contains("0"))
        {
            veApplyVoList = this.veApplyMapper.selectAll(veApplyVo, startLine, pageSize, veCommon);
        }
        else if (veCommon.getUserType().equals("1"))
        {
            List<Integer> stuBjIdList = new ArrayList();

            List<VeClassTeacher> veClassTeacherList = this.veClassTeacharService.getBanjiIdByTeacherUserId(veCommon.getUserId());
            for (VeClassTeacher veClassTeacher : veClassTeacherList) {
                if ((veClassTeacher != null) && (!"".equals(veClassTeacher))) {
                    stuBjIdList.add(Integer.valueOf(veClassTeacher.getBjId()));
                }
            }
            veCommon.setStuBjId(stuBjIdList);
            if ((stuBjIdList != null) && (stuBjIdList.size() > 0)) {
                veApplyVoList = this.veApplyMapper.selectAll(veApplyVo, startLine, pageSize, veCommon);
            } else {
                veApplyVoList = new ArrayList();
            }
        }
        else if (veCommon.getUserType().equals("2"))
        {
            Object stuResult = this.veCommonClient.queryStudentById("09d5e1e7f9b049008eee645c783a1d67", veCommon.getUserId()).getResult();
            Map stuMap = (Map)stuResult;
            if (stuMap != null)
            {
                veCommon.setStuId(Integer.parseInt(stuMap.get("id").toString()));
                veApplyVoList = this.veApplyMapper.selectAll(veApplyVo, startLine, pageSize, veCommon);
            }
        }
        else if ((veCommon.getUserType().equals("4")) || (veCommon.getUserType().equals("3")))
        {
            veCompanyUser = this.veCompanyUserService.getCpInfoByUserId(veCommon.getUserId());
            veCommon.setCpId(veCompanyUser.getCpId());

            veApplyVoList = this.veApplyMapper.selectAll(veApplyVo, startLine, pageSize, veCommon);
        }
        if ((veApplyVoList != null) && (veApplyVoList.size() > 0)) {
            for (VeApplyVo applyVo : veApplyVoList)
            {
                if (applyVo.getStatus() == 0) {
                    applyVo.setStatuss("待审核");
                } else if (applyVo.getStatus() == 1) {
                    applyVo.setStatuss("审核通过");
                } else if (applyVo.getStatus() == 2) {
                    applyVo.setStatuss("未通过");
                } else if (applyVo.getStatus() == -1) {
                    applyVo.setStatuss("停用");
                } else {
                    applyVo.setStatuss("停用");
                }
                if (applyVo.getType() == 0) {
                    applyVo.setTypes("未知");
                } else if (applyVo.getType() == 1) {
                    applyVo.setTypes("集中实习");
                } else if (applyVo.getType() == 2) {
                    applyVo.setTypes("分散实习");
                } else {
                    applyVo.setTypes("未知");
                }
                applyVo.setApplyTime(DateUtils.getDateToString(Long.parseLong(applyVo.getApplyTime())));
            }
        }
        return veApplyVoList;
    }

    public int getSumPage(VeApplyVo veApplyVo, VeCommon veCommon)
    {
        int pageNum = 0;
        if (veCommon.getUserType().contains("0"))
        {
            pageNum = this.veApplyMapper.getSumPage(veApplyVo, veCommon);
        }
        else if (veCommon.getUserType().equals("1"))
        {
            List<Integer> stuBjIdList = new ArrayList();

            List<VeClassTeacher> veClassTeacherList = this.veClassTeacharService.getBanjiIdByTeacherUserId(veCommon.getUserId());
            for (VeClassTeacher veClassTeacher : veClassTeacherList) {
                if ((veClassTeacher != null) && (!"".equals(veClassTeacher))) {
                    stuBjIdList.add(Integer.valueOf(veClassTeacher.getBjId()));
                }
            }
            veCommon.setStuBjId(stuBjIdList);
            if ((stuBjIdList != null) && (stuBjIdList.size() > 0)) {
                pageNum = this.veApplyMapper.getSumPage(veApplyVo, veCommon);
            } else {
                pageNum = 0;
            }
        }
        else if (veCommon.getUserType().equals("2"))
        {
            Object stuResult = this.veCommonClient.queryStudentById("09d5e1e7f9b049008eee645c783a1d67", veCommon.getUserId()).getResult();
            Map stuMap = (Map)stuResult;
            if (stuMap != null)
            {
                veCommon.setStuId(Integer.parseInt(stuMap.get("id").toString()));
                pageNum = this.veApplyMapper.getSumPage(veApplyVo, veCommon);
            }
        }
        else if ((veCommon.getUserType().equals("4")) || (veCommon.getUserType().equals("3")))
        {
            VeCompanyUser veCompanyUser = this.veCompanyUserService.getCpInfoByUserId(veCommon.getUserId());
            veCommon.setCpId(veCompanyUser.getCpId());

            pageNum = this.veApplyMapper.getSumPage(veApplyVo, veCommon);
        }
        return pageNum;
    }

    public VeApplyInfoVo getOneInfo(int id)
    {
        VeApplyInfoVo veApplyInfoVo = new VeApplyInfoVo();

        VeApply veApply = (VeApply)this.veApplyService.getById(Integer.valueOf(id));





        veApplyInfoVo.setId(veApply.getId());

        veApplyInfoVo.setApplyTime(veApply.getApplyTime());

        veApplyInfoVo.setPostId(veApply.getPostId());

        veApplyInfoVo.setPostName(veApply.getPostName());

        veApplyInfoVo.setCpId(veApply.getCpId());

        veApplyInfoVo.setBjId(veApply.getBjId());

        veApplyInfoVo.setCpName(veApply.getCpName());

        veApplyInfoVo.setStartTime(veApply.getStartTime());

        veApplyInfoVo.setEndTime(veApply.getEndTime());

        veApplyInfoVo.setCteacherUserId(veApply.getCteacherUserId());

        veApplyInfoVo.setXh(veApply.getXh());

        veApplyInfoVo.setXm(veApply.getXm());



        veApplyInfoVo.setAddress(veApply.getAddress());




        Object stuInfoResult = this.veCommonClient.getStudentInfoById("09d5e1e7f9b049008eee645c783a1d67", veApply.getStuUserId()).getResult();
        Map stuInfoMap = (Map)stuInfoResult;
        String s = JSON.toJSONString(stuInfoMap);
        VeStudentInfo veStuInfo = (VeStudentInfo)JSON.parseObject(s, VeStudentInfo.class);
        if ((veStuInfo != null) && (!"".equals(veStuInfo)))
        {
            veApplyInfoVo.setXslxdh(veStuInfo.getXslxdh());

            veApplyInfoVo.setJstxh(veStuInfo.getJstxh());

            veApplyInfoVo.setJtdz(veStuInfo.getJtdz());

            veApplyInfoVo.setJtlxdh(veStuInfo.getJtlxdh());
        }
        veApplyInfoVo.setApplyTimes(DateUtils.getDateToString(veApplyInfoVo.getApplyTime()));
        veApplyInfoVo.setEndTimes(DateUtils.getDateToString(veApplyInfoVo.getEndTime()));
        veApplyInfoVo.setStartTimes(DateUtils.getDateToString(veApplyInfoVo.getStartTime()));


        VeCompany veCompany = (VeCompany)this.veCompanyService.getById(Integer.valueOf(veApply.getCpId()));
        if ((veCompany != null) && (!"".equals(veCompany)))
        {
            veApplyInfoVo.setLinkman(veCompany.getLinkman());

            veApplyInfoVo.setTel(veCompany.getTel());
        }
        List<String> teacherNameList = this.veApplyMapper.getTeacherNameByBjId(veApply.getBjId());
        for (int i = 0; i < teacherNameList.size(); i++) {
            veApplyInfoVo.setXxzdjs(teacherNameList.toString().replace("[", "").replace("]", ""));
        }
        List<String> cpTeacherNameList = this.veApplyMapper.getCpTeacherUserNameByCpId(veApply.getCpId(), veApply.getPostId());
        for (int i = 0; i < cpTeacherNameList.size(); i++) {
            veApplyInfoVo.setCteacherUser((String)cpTeacherNameList.get(0));
        }
        String bjNameById = this.veApplyMapper.getBjNameById(veApplyInfoVo.getBjId());
        if ((bjNameById != null) && (!"".equals(bjNameById))) {
            veApplyInfoVo.setBjIds(bjNameById);
        }
        String specsName = this.veApplyMapper.getSpecsName(veApply.getSpecId());
        if ((specsName != null) && (!"".equals(specsName))) {
            veApplyInfoVo.setSpecs(specsName);
        }
        if (veApply.getStatus() == 0) {
            veApplyInfoVo.setStatuss("待审核");
        } else if (veApply.getStatus() == 1) {
            veApplyInfoVo.setStatuss("审核通过");
        } else if (veApply.getStatus() == 2) {
            veApplyInfoVo.setStatuss("未通过");
        } else if (veApply.getStatus() == -1) {
            veApplyInfoVo.setStatuss("停用");
        }
        return veApplyInfoVo;
    }

    public void updatePass(List<VeApply> veApplyList)
    {
        for (VeApply veApply : veApplyList)
        {
            VeApply veApplys = (VeApply)this.veApplyService.getById(Integer.valueOf(veApply.getId()));
            veApplys.setStatus(1);
            this.veApplyService.updateById(veApplys);
        }
    }

    public void updateNoPass(List<VeApply> veApplyList)
    {
        for (VeApply veApply : veApplyList)
        {
            VeApply veApplys = (VeApply)this.veApplyService.getById(Integer.valueOf(veApply.getId()));
            veApplys.setStatus(2);
            this.veApplyService.updateById(veApplys);
        }
    }

    public Result<?> addFocus(VeApplyAddVo veApplyAddVo)
    {
        VeApply veApply = new VeApply();




        Object stuResult = this.veCommonClient.queryStudentById("09d5e1e7f9b049008eee645c783a1d67", veApplyAddVo.getUserId()).getResult();
        Map stuMap = (Map)stuResult;
        String s = JSON.toJSONString(stuMap);
        VeStudent veStudent = (VeStudent)JSON.parseObject(s, VeStudent.class);



        veApply.setCpId(veApplyAddVo.getCpId());

        veApply.setPostId(veApplyAddVo.getPostId());

        System.out.println(DateUtils.getStringToDate(veApplyAddVo.getStartTime()));
        veApply.setStartTime(DateUtils.getStringToDate(veApplyAddVo.getStartTime()));

        veApply.setEndTime(DateUtils.getStringToDate(veApplyAddVo.getEndTime()));

        veApply.setAddress(veApplyAddVo.getAddress());



        veApply.setType(1);

        String postName = ((VePost)this.vePostService.getById(Integer.valueOf(veApplyAddVo.getPostId()))).getPostName();
        if ((postName != null) && (!"".equals(postName))) {
            veApply.setPostName(postName);
        }
        if ((veStudent != null) && (!"".equals(veStudent)))
        {
            veApply.setFalId(veStudent.getFalId());

            veApply.setSpecId(veStudent.getSpecId());

            veApply.setGradeId(veStudent.getGradeId());

            veApply.setBjId(veStudent.getBjId());

            veApply.setStuUserId(veStudent.getId());
            if ((veStudent.getXh() != null) && (!"".equals(veStudent.getXh()))) {
                veApply.setXh(veStudent.getXh());
            }
            if ((veStudent.getSfzh() != null) && (!"".equals(veStudent.getSfzh()))) {
                veApply.setSfzh(veStudent.getSfzh());
            }
            if ((veStudent.getXm() != null) && (!"".equals(veStudent.getXm()))) {
                veApply.setXm(veStudent.getXm());
            }
        }
        String cpName = ((VeCompany)this.veCompanyService.getById(Integer.valueOf(veApplyAddVo.getCpId()))).getName();
        if ((cpName != null) && (!"".equals(cpName))) {
            veApply.setCpName(cpName);
        }
        List<Integer> cpCteacherList = this.veApplyMapper.getCteacherUserByCpId(veApplyAddVo.getCpId());
        if ((cpCteacherList != null) && (cpCteacherList.size() > 0)) {
            veApply.setCteacherUserId(((Integer)cpCteacherList.get(0)).intValue());
        }
        veApply.setStatus(0);


        veApply.setApplyTime(System.currentTimeMillis());

        veApply.setUpdateTime(System.currentTimeMillis());

        veApply.setTerminalId(1);
        try
        {
            this.veApplyService.save(veApply);
        }
        catch (Exception e)
        {
            return Result.error("网络连接超时");
        }
        return Result.OK("添加成功");
    }

    public Result addDis(VeApplyAddVo veApplyAddVo)
    {
        VeApply veApply = new VeApply();


        veApply.setType(2);

        veApply.setPostId(0);
        if ((veApplyAddVo.getPostName() == null) || ("".equals(veApplyAddVo.getPostName()))) {
            return Result.error("岗位信息不能为空");
        }
        veApply.setPostName(veApplyAddVo.getPostName());
        if ((veApplyAddVo.getUserId() == null) || ("".equals(veApplyAddVo.getUserId()))) {
            return Result.error("学生信息有误");
        }
        Object stuResult = this.veCommonClient.queryStudentById("09d5e1e7f9b049008eee645c783a1d67", veApplyAddVo.getUserId()).getResult();
        Map stuMap = (Map)stuResult;
        String s = JSON.toJSONString(stuMap);
        VeBaseStudent veBaseStudent = (VeBaseStudent)JSON.parseObject(s, VeBaseStudent.class);
        if ((veBaseStudent != null) && (!"".equals(veBaseStudent)))
        {
            veApply.setFalId(veBaseStudent.getFalId().intValue());

            veApply.setSpecId(veBaseStudent.getSpecId().intValue());

            veApply.setGradeId(veBaseStudent.getGradeId().intValue());

            veApply.setBjId(veBaseStudent.getBjId().intValue());

            veApply.setStuUserId(veBaseStudent.getId().intValue());

            veApply.setXh(veBaseStudent.getXh());

            veApply.setSfzh(veBaseStudent.getSfzh());

            veApply.setXm(veBaseStudent.getXm());
        }
        veApply.setCpId(0);
        if ((veApplyAddVo.getCpName() == null) || ("".equals(veApplyAddVo.getCpName()))) {
            return Result.error("企业名称不能为空");
        }
        veApply.setCpName(veApplyAddVo.getCpName());
        if ((veApplyAddVo.getStartTime() == null) || ("".equals(veApplyAddVo.getStartTime()))) {
            return Result.error("开始时间不能为空");
        }
        veApply.setStartTime(DateUtils.getStringToDate(veApplyAddVo.getStartTime()));
        if ((veApplyAddVo.getEndTime() == null) || ("".equals(veApplyAddVo.getEndTime()))) {
            return Result.error("结束时间不能为空");
        }
        veApply.setEndTime(DateUtils.getStringToDate(veApplyAddVo.getEndTime()));



        veApply.setStatus(0);


        veApply.setTerminalId(1);

        veApply.setApplyTime(System.currentTimeMillis());

        veApply.setUpdateTime(System.currentTimeMillis());

        veApply.setAddress(veApplyAddVo.getAddress());

        this.veApplyService.save(veApply);
        return Result.OK("申请成功");
    }

    public List<Integer> getCpToPostId(int id)
    {
        List<Integer> postId = this.veApplyMapper.getCpToPostId(id);

        return postId;
    }

    public VeApply getByIds(int stuId)
    {
        return this.veApplyMapper.getByIds(stuId);
    }

    public VeApplyEditVo disperseEcho(VeApply veApply)
    {
        VeApplyEditVo veApplyEditVo = new VeApplyEditVo();


        veApplyEditVo.setId(veApply.getId());


        veApplyEditVo.setCp(veApply.getCpName());

        veApplyEditVo.setPostName(veApply.getPostName());

        veApplyEditVo.setStartTime(DateUtils.getDateToString(veApply.getStartTime()));

        veApplyEditVo.setEndTime(DateUtils.getDateToString(veApply.getEndTime()));

        veApplyEditVo.setAddress(veApply.getAddress());

        VeCompany veCompany = (VeCompany)this.veCompanyService.getById(Integer.valueOf(veApply.getCpId()));

        veApplyEditVo.setCpName(veCompany.getName());

        veApplyEditVo.setTel(veCompany.getTel());

        veApplyEditVo.setLinkman(veCompany.getLinkman());

        veApplyEditVo.setEmail(veCompany.getEmail());

        veApplyEditVo.setFax(veCompany.getFax());

        veApplyEditVo.setCpAddress(veCompany.getAddress());

        veApplyEditVo.setTradeId(veCompany.getTradeId());

        veApplyEditVo.setEstateId(veCompany.getEstateId());

        veApplyEditVo.setNature(veCompany.getNature());

        veApplyEditVo.setScale(veCompany.getScale());

        veApplyEditVo.setIsCity(veCompany.getIsCity());

        veApplyEditVo.setIsWorld500(veCompany.getIsWorld500());


        return veApplyEditVo;
    }

    public void focusEdit(VeApplyEditVo veApplyEditVo)
    {
        VeApply veApply = (VeApply)this.veApplyService.getById(Integer.valueOf(veApplyEditVo.getId()));
        if ((veApply != null) && (!"".equals(veApply)))
        {
            veApply.setCpId(veApplyEditVo.getCpId());
            String cpName = ((VeCompany)this.veCompanyService.getById(Integer.valueOf(veApplyEditVo.getCpId()))).getName();
            if ((cpName != null) && (!"".equals(cpName))) {
                veApply.setCpName(cpName);
            }
            veApply.setPostId(veApplyEditVo.getPostId());
            String postName = ((VePost)this.vePostService.getById(Integer.valueOf(veApplyEditVo.getPostId()))).getPostName();
            if ((postName != null) && (!"".equals(postName))) {
                veApply.setPostName(postName);
            }
            veApply.setStartTime(DateUtils.getStringToDate(veApplyEditVo.getStartTime()));

            veApply.setEndTime(DateUtils.getStringToDate(veApplyEditVo.getEndTime()));

            veApply.setAddress(veApplyEditVo.getAddress());
        }
        this.veApplyService.updateById(veApply);
    }

    public void disperseEdit(VeApplyEditVo veApplyEditVo)
    {
        VeApply veApply = (VeApply)this.veApplyService.getById(Integer.valueOf(veApplyEditVo.getId()));




        veApply.setCpId(veApplyEditVo.getCpId());
        String cpName = ((VeCompany)this.veCompanyService.getById(Integer.valueOf(veApplyEditVo.getCpId()))).getName();
        if ((cpName != null) && (!"".equals(cpName))) {
            veApply.setCpName(cpName);
        }
        veApply.setPostId(veApplyEditVo.getPostId());
        String postName = ((VePost)this.vePostService.getById(Integer.valueOf(veApplyEditVo.getPostId()))).getPostName();
        if ((postName != null) && (!"".equals(postName))) {
            veApply.setPostName(postName);
        }
        veApply.setStartTime(DateUtils.getStringToDate(veApplyEditVo.getStartTime()));

        veApply.setEndTime(DateUtils.getStringToDate(veApplyEditVo.getEndTime()));

        veApply.setAddress(veApplyEditVo.getAddress());































        this.veApplyService.updateById(veApply);
    }

    public VeApplyEditVo focusEcho(VeApply veApply)
    {
        VeApplyEditVo veApplyEditVo = new VeApplyEditVo();


        veApplyEditVo.setId(veApply.getId());


        veApplyEditVo.setStartTime(DateUtils.getDateToString(veApply.getStartTime()));

        veApplyEditVo.setEndTime(DateUtils.getDateToString(veApply.getEndTime()));

        veApplyEditVo.setAddress(veApply.getAddress());

        veApplyEditVo.setCpId(veApply.getCpId());
        String cpName = ((VeCompany)this.veCompanyService.getById(Integer.valueOf(veApply.getCpId()))).getName();
        if ((cpName != null) && (!"".equals(cpName))) {
            veApplyEditVo.setCpName(cpName);
        }
        veApplyEditVo.setPostId(veApply.getPostId());
        String postName = ((VePost)this.vePostService.getById(Integer.valueOf(veApply.getPostId()))).getPostName();
        if ((postName != null) && (!"".equals(postName))) {
            veApplyEditVo.setPostName(postName);
        }
        return veApplyEditVo;
    }

    public Result<?> stuIsStatusApply(String userType, String userId)
    {
        if (userType.equals("2"))
        {
            Result<?> result = this.veCommonClient.queryStudentById("09d5e1e7f9b049008eee645c783a1d67", userId);
            Object stuResult = result.getResult();
            Map stuMap = (Map)stuResult;
            if ((stuMap != null) && (!"".equals(stuMap)))
            {
                String s = JSON.toJSONString(stuMap);
                VeBaseStudent veBaseStudent = (VeBaseStudent)JSON.parseObject(s, VeBaseStudent.class);
                if ((veBaseStudent != null) && (!"".equals(veBaseStudent)))
                {
                    List<VeApply> veApplyList = this.veApplyMapper.getStuStatusIsApply(veBaseStudent.getId());
                    if ((veApplyList == null) || (veApplyList.size() == 0))
                    {
                        boolean b = true;
                        return Result.OK(Boolean.valueOf(b));
                    }
                    boolean b = false;
                    return Result.OK(Boolean.valueOf(b));
                }
            }
        }
        return Result.OK();
    }

    public Result<?> deleteById(int id)
    {
        if (id != 0)
        {
            VeApply veApply = (VeApply)this.veApplyService.getById(Integer.valueOf(id));
            int stuUserId = veApply.getStuUserId();
            if (stuUserId != 0)
            {
                this.vePracticeMapper.deleteNewApplyByStuUserId(stuUserId);

                this.vePracticeMapper.deleteApplyByStuUserId(stuUserId);

                this.vePracticeMapper.deleteAttendanceByStuId(stuUserId);

                this.vePracticeMapper.deleteChangeByStuId(stuUserId);

                this.vePracticeMapper.deleteDynamicByStuId(stuUserId);

                this.vePracticeMapper.deleteLogByStuId(stuUserId);

                this.vePracticeMapper.deleteResultByStuId(stuUserId);

                this.vePracticeMapper.deleteSumupByStuId(stuUserId);

                this.veApplyMapper.deletePracticeByStuId(stuUserId);
            }
            return Result.OK("删除成功");
        }
        return Result.OK();
    }

    public Result<?> deleteBatch(String ids)
    {
        if ((ids != null) && (!"".equals(ids)))
        {
            List<String> stringList = Arrays.asList(ids.split(","));
            for (String id : stringList)
            {
                VeApply veApply = (VeApply)this.veApplyService.getById(id);
                int stuUserId = veApply.getStuUserId();
                if (stuUserId != 0)
                {
                    this.vePracticeMapper.deleteNewApplyByStuUserId(stuUserId);

                    this.vePracticeMapper.deleteApplyByStuUserId(stuUserId);

                    this.vePracticeMapper.deleteAttendanceByStuId(stuUserId);

                    this.vePracticeMapper.deleteChangeByStuId(stuUserId);

                    this.vePracticeMapper.deleteDynamicByStuId(stuUserId);

                    this.vePracticeMapper.deleteLogByStuId(stuUserId);

                    this.vePracticeMapper.deleteResultByStuId(stuUserId);

                    this.vePracticeMapper.deleteSumupByStuId(stuUserId);

                    this.veApplyMapper.deletePracticeByStuId(stuUserId);
                }
            }
            return Result.OK("批量删除成功");
        }
        return Result.OK();
    }

    public VeApply getApplyByUserId(String userId, Integer status)
    {
        return this.veApplyMapper.getApplyByUserId(userId, status);
    }
}
